import type { IQuery, IResponse, TableResponse } from '@/api/config/types';
import axios from 'axios'; // 确保你导入了正确的 axios 实例或配置

export interface ThemeComponents {
  width: number;
  height: number;
  scale: number;
  imgSrc: string;
  deptId: string;
  templateId: string;
  templateName: string;
  templateData: string;
  major: any;
  templateList?: Array<any>;
}

const prefix = '/theme/component';

export const listThemeComponents = (query?: IQuery) => {
  return axios.get<TableResponse<ThemeComponents>>(`${prefix}/list`, { params: query });
};
export const createThemeComponent = (data: ThemeComponents) => {
  return axios.post<IResponse>(`${prefix}`, data);
};

export const getThemeComponent = (id: string) => {
  return axios.get<IResponse<ThemeComponents>>(`${prefix}/${id}`);
};

export const deleteThemeComponents = (ids: string[]) => {
  return axios.delete<IResponse>(`${prefix}/${ids.join(',')}`);
};

export const updateThemeComponent = (data: ThemeComponents) => {
  return axios.put<IResponse>(`${prefix}`, data);
};
